import Vue from 'vue'
import Vuex from 'vuex'
import goods from "@/store/modules/Goods.js"
import {ApiGetSearchData } from "@/utils/api.js"
Vue.use(Vuex)

const store = new Vuex.Store({
	state:{
		storeIndex:0,
		showSearch:false,
		secrch:'',
		mytolen:uni.getStorageSync('token')
	},
	mutations:{
		tabbarIndex(state,val){
			state.storeIndex = val
		},
		 SearchMutations(state,val){
			state.showSearch=val
		},
		SearchMut(state,val){
			state.secrch=val
			// console.log(state.secrch)
		},
		myToken(state,token){
			state.mytolen = token
		}
	},
	
	actions:{
		async ActionsApiGetSearchData({commit}){
			let res=await ApiGetSearchData()
			commit('SearchMut',res.data)
			// console.log(res.data,"获取数据成功");
		}
		},
		modules:{
			goods
			}
		})
export default store